var texto = document.querySelector('#texto')
var textoTrocar = document.querySelector('#textoTrocar')

texto.addEventListener('click', mudarTexto)

function mudarTexto() {
  var xhttp = new XMLHttpRequest()
  xhttp.onreadystatechange = function () {
    if (xhttp.readyState == 4 && xhttp.status == 200) {
      console.log(xhttp.responseText)
      textoTrocar.innerHTML = xhttp.responseText
    }
  }
  xhttp.open('GET', 'file.txt', true)
  xhttp.send()
}


